﻿using System;
using System.Collections.Generic;
using System.Linq; 

namespace CoolCode
{
    public static class ElementExtensions
    {
        public static bool InRange<T>(this IComparable<T> t, T minT, T maxT)
        {
            return t.CompareTo(minT) >= 0 && t.CompareTo(maxT) <= 0;
        }

        public static bool InRange(this IComparable t, object minT, object maxT)
        {
            return t.CompareTo(minT) >= 0 && t.CompareTo(maxT) <= 0;
        }

        //public static bool InRange(this decimal value, decimal minValue, decimal maxValue)
        //{
        //    return value >= minValue && value <= maxValue;
        //}

        //public static bool InRange<T>(this T t, T minT, T maxT) where T : IComparable<T>
        //{
        //    return t.CompareTo(minT) >= 0 && t.CompareTo(maxT) <= 0;
        //} 

        //public static bool InRange<T>(this System.Nullable<T>  t, T minT, T maxT) where T : IComparable<T>
        //{
        //    if (t == null) return false;
        //    return InRange(t.GetValueOrDefault(), minT, maxT);
        //}

    }
     
}
